package com.epower.tools.bean;


import org.apache.log4j.Logger;

/**
 * @description: ${描述}
 * @author: LIU JUN
 * @create: 2021-03-21 15:52
 */

public class AnalogChannelInfo {
    static Logger logger = Logger.getLogger(AnalogChannelInfo.class);
    private String an;
    private String chId;
    private String ph;
    private String ccbm;
    private String uu;
    /**
     * 通道乘数
     */
    private String a;
    private String b;
    private String skew;
    private String min;
    private String max;
    private String primary;
    private String secondary;
    private String ps;

    public static AnalogChannelInfo newInstance(String text) throws Exception {
        return new AnalogChannelInfo(text);
    }

    public AnalogChannelInfo(String text) {
        if (text == null) {
            return;
        }
        //An,ch_id,ph,ccbm,uu,a,b,skew,min,max,primary,secondary,PS

        String[] arr = text.split(",");
        if (arr.length != 13) {
            logger.debug("解析行失败，内容:" + text + " 不符合 An,ch_id,ph,ccbm,uu,a,b,skew,min,max,primary,secondary,PS");
        }
        this.an = arr[0];
        this.chId = arr[1];
        this.ph = arr[2];
        this.ccbm = arr[3];
        this.uu = arr[4];
        this.a = arr[5];
        this.b = arr[6];
        this.skew = arr[7];
        this.min = arr[8];
        this.max = arr[9];
        this.primary = arr[10];
        this.secondary = arr[11];
        this.ps = arr[12];
    }


    public String getAn() {
        return an;
    }

    public void setAn(String an) {
        this.an = an;
    }

    public String getChId() {
        return chId;
    }

    public void setChId(String chId) {
        this.chId = chId;
    }

    public String getPh() {
        return ph;
    }

    public void setPh(String ph) {
        this.ph = ph;
    }

    public String getCcbm() {
        return ccbm;
    }

    public void setCcbm(String ccbm) {
        this.ccbm = ccbm;
    }

    public String getUu() {
        return uu;
    }

    public void setUu(String uu) {
        this.uu = uu;
    }

    public String getA() {
        return a;
    }

    public void setA(String a) {
        this.a = a;
    }

    public String getB() {
        return b;
    }

    public void setB(String b) {
        this.b = b;
    }

    public String getSkew() {
        return skew;
    }

    public void setSkew(String skew) {
        this.skew = skew;
    }

    public String getMin() {
        return min;
    }

    public void setMin(String min) {
        this.min = min;
    }

    public String getMax() {
        return max;
    }

    public void setMax(String max) {
        this.max = max;
    }

    public String getPrimary() {
        return primary;
    }

    public void setPrimary(String primary) {
        this.primary = primary;
    }

    public String getSecondary() {
        return secondary;
    }

    public void setSecondary(String secondary) {
        this.secondary = secondary;
    }

    public String getPs() {
        return ps;
    }

    public void setPs(String ps) {
        this.ps = ps;
    }

    /**
     * 乘法系数值
     *
     * @return
     */
    public Double chanMultiRate() {
        return Double.valueOf(this.a);
    }

    @Override
    public String toString() {
        return "AnalogChannelInfo{" +
                "an='" + an + '\'' +
                ", chId='" + chId + '\'' +
                ", ph='" + ph + '\'' +
                ", ccbm='" + ccbm + '\'' +
                ", uu='" + uu + '\'' +
                ", a='" + a + '\'' +
                ", b='" + b + '\'' +
                ", skew='" + skew + '\'' +
                ", min='" + min + '\'' +
                ", max='" + max + '\'' +
                ", primary='" + primary + '\'' +
                ", secondary='" + secondary + '\'' +
                ", ps='" + ps + '\'' +
                '}';
    }
}
